package com.atguigu.system.controller;

import com.atguigu.common.result.Result;
import com.atguigu.model.system.SysLoginLog;
import com.atguigu.model.vo.SysLoginLogQueryVo;
import com.atguigu.system.service.SysLoginLogService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "登录日志管理")
@RestController
@RequestMapping("/admin/system/sysLoginLog")
public class SysLoginLogController {

    @Autowired
    private SysLoginLogService sysLoginLogService;

    @ApiOperation("分页及带条件查询的方法")
    @GetMapping("/{current}/{size}")
    public Result findPage(@PathVariable Long current , @PathVariable Long size , SysLoginLogQueryVo loginLogQueryVo){
        //创建Page对象
        Page<SysLoginLog> page = new Page<>(current, size);
        //调用SysLoinLogService中分页及带条件查询的方法
        IPage<SysLoginLog> iPage = sysLoginLogService.findPage(page,loginLogQueryVo);
        return Result.ok(iPage);
    }
}
